<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                   http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.15.xsd">
    <changeSet id="init-table-TENNIS_USERS-1" author="alisitsin">
        <preConditions onFail="MARK_RAN">
            <not>
                <tableExists tableName="TENNIS_USERS"/>
            </not>
        </preConditions>
        <createTable tableName="TENNIS_USERS">
            <column name="TENNIS_USER_ID" type="integer" remarks="Идентификатор пользователя сервиса (первичный ключ)">
                <constraints primaryKey="true" primaryKeyName="PK_TENNIS_USER_ID" nullable="false"/>
            </column>
            <column name="LOGIN" type="varchar(255)" remarks="Логин пользователя"/>
            <column name="PASSWORD" type="varchar(255)" remarks="Пароль (в зашифрованном виде)"/>
        </createTable>
        <comment>create table TENNIS_USERS</comment>
    </changeSet>

    <changeSet id="add-TENNIS_USER_ID_SEQ_GEN-1" author="alisitsin">
        <preConditions onFail="MARK_RAN">
            <not>
                <sequenceExists sequenceName="TENNIS_USER_ID_SEQ"/>
            </not>
        </preConditions>
        <createSequence sequenceName="TENNIS_USER_ID_SEQ" minValue="1000" maxValue="9223372036854775807"
                        startValue="1000" incrementBy="1"/>
        <comment>add TENNIS_USER seq</comment>
    </changeSet>

</databaseChangeLog>